package com.heny.demo.utils;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

/**
 * @author litao.cc
 * @version DateTimeUtils.java v0.1 t2025/5/5 22:59
 * @date 2025/5/5 22:59
 * @description
 */
public class DateTimeUtils {

    public static LocalDateTime convert(Date date) {
        return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
    }

    public static void main(String[] args) {
        Date date = new Date();
        LocalDateTime convert = convert(date);
        System.out.println(convert.getYear());
        System.out.println(convert.getMonth().getValue());
        System.out.println(convert.getDayOfMonth());
        System.out.println(convert.getHour());
    }
}
